package com.air.designmodel.four;


import com.air.designmodel.four.coffee.Espresso;
import com.air.designmodel.four.coffee.HouseBlend;
import com.air.designmodel.four.decorator.Mocha;
import com.air.designmodel.four.decorator.Whip;

/**
 * 装饰者模式测试类
 *
 * @author shent
 */
public class StarbuzzCoffee {
    public static void main(String[] args) {
        //一杯浓缩咖啡
        Beverage beverage = new Espresso();
        System.out.println(beverage.getDescription() + " $" + beverage.cost());

        //一杯双倍摩卡+奶泡的综合咖啡
        Beverage beverage1 = new HouseBlend();
        beverage1 = new Mocha(beverage1);
        beverage1 = new Mocha(beverage1);
        beverage1 = new Whip(beverage1);
        //上面三行等于下面一行
        beverage1 = new Whip(new Mocha(new Mocha(beverage1)));
        System.out.println(beverage1.getDescription() + " $" + beverage1.cost());
    }
}
